<?php

$config = array(
	'pay_config'=>'wxpay'	
);

abstract class Payment{
	abstract function pay();
} 

class AliPay extends Payment{
	
	public function pay(){
		echo 'aliPay支付<br/>';	
	}
}

class WxPay extends Payment{
	
	public function pay(){
		echo '微信支付<br/>';	
	}
}

Class SimpleFactory{
	public static function pay($class_name){
		if($class_name == 'alipay'){
			return new AliPay();
		}else if($class_name == 'wxpay'){
			return new WxPay();
		}
		return null;
	}
}

$pay = SimpleFactory::pay($config['pay_config']);
$pay->pay();
$pay = SimpleFactory::pay($config['pay_config']);
$pay->pay();
?>